import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import VueDragResize from 'vue-drag-resize'
import ViewUI from 'view-design';
import 'view-design/dist/styles/iview.css';
import VueCodemirror from 'vue-codemirror'

import 'codemirror/lib/codemirror.css'
import VueSlider from 'vue-slider-component'
import 'vue-slider-component/theme/default.css'
import {addComponentUrl} from "@/utils/Utils";
import {Canvas} from './entity/Canvas';

Vue.component('VueSlider', VueSlider)

Vue.use(VueCodemirror, /* {
  options: { theme: 'base16-dark', ... },
  events: ['scroll', ...]
} */)
Vue.config.productionTip = false
Vue.component('vue-drag-resize', VueDragResize)
Vue.use(ViewUI);
window['Vue'] = Vue;
// 初始化开始的组件

let canvas = new Canvas().getCanvasInfo();
const component = new Set();
let item;
for (item of canvas.data) {
    component.add(item.name);
}
const componentArr = [...component];
let componentUrl = [];
for (const el of componentArr) {
    for (item of init) {
        if (item.name == el) {
            componentUrl.push(item.src);
        }
    }
}
addComponentUrl(componentUrl).then(() => {
    new Vue({
        router,
        store,
        render: function (h) {
            return h(App)
        }
    }).$mount('#app')
});
